import 'dart:convert';

String? websocket = "";

String checkRfid() {
  Map<String,dynamic> data = {
    "cmd": "rfid_hf_check",
  };
  // if(settingEntity.isUltra!){
  //   data['cmd'] = "rfid_uhf_check";
  // }
  return json.encode(data);
}

String inventoryUhfRfid({required String readerIp,required String ant, required int count , bool includeTid = false}) {
  Map<String,dynamic> data = {
    "cmd": "rfid_uhf_scan",
    "data": {
      "reader":readerIp,
      "ants":ant,
      "count":count,
      "include_tid": includeTid,
    }
  };
  return json.encode(data);
}


String inventoryHfRfid() {
  Map<String,dynamic> data = {
    "cmd": "rfid_hf_scan",
    "data": {
      "count": 1,
      "read_block": true,
      "block_start": 0,
      "block_count": 3
    }
  };
  return json.encode(data);
}

String setEas(uid,no,isReturn) {
  Map<String,dynamic> data = {
    "cmd": "rfid_hf_eas",
    "data": {
      "uid": uid,
      "no": no,
      "eas": !isReturn,
    }
  };
  return json.encode(data);
}

String setAfi(uid,no,code) {
  Map<String,dynamic> data = {
    "cmd": "rfid_hf_afi",
    "data": {
      "uid": uid,
      "no": no,
      "afi": code,
    }
  };
  return json.encode(data);
}

String checkReader() {
  Map<String,dynamic> data = {
    "cmd": "rfid_hf_check",
  };
  return json.encode(data);
}

String m1Inventory() {
  Map<String,dynamic> data = {
    "cmd": "card_reader_m1_inventory",
  };
  return json.encode(data);
}
String icrInventory() {
  Map<String,dynamic> data = {
    "cmd": "card_reader_icr_inventory",
  };
  return json.encode(data);
}

String readReaderBlock({required int no}) {
  Map<String,dynamic> data = {
    "cmd": "card_reader_m1_inventory",
    "data": {
      "no": no
    }
  };
  return json.encode(data);
}

